class Solution {
public:
    void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) 
    {
        vector<int>nums3(m + 1 + n);
        int cur1 = 0 , cur2 = 0 , cur = 0;
        while(cur1 < m && cur2 < n)
        {
            if(nums1[cur1] <= nums2[cur2]) nums3[cur++] = nums1[cur1++];
        else nums3[cur++] = nums2[cur2++];
        }
        while(cur1 < m) nums3[cur++] = nums1[cur1++];
        while(cur2 < n) nums3[cur++] = nums2[cur2++];
        for(int i = 0;i < m + n;i ++) nums1[i] = nums3[i];
    }
};